<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    
<%@ taglib uri="http://java.sun.com/jsp/jstl/sql" prefix="sql" %>    
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>    

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
	
	<!--1.加载驱动 -->
	<sql:setDataSource driver="com.mysql.cj.jdbc.Driver"
			url="jdbc:mysql://localhost:3306/scott_db?serverTimezone=GMT%2B8"
			user="root"
			password="123456"
			var="ds" />
	<!--2.操作数据库 -->
	<sql:query var="result" dataSource="${ds}">
		select * from flower;
	</sql:query>
	
	<table border="1">
		<c:forEach items="${result.rows}" var="f">
			<tr>
				<td>${f.code}</td>
				<td>${f.name}</td>
				<td>${f.price}</td>
				<td>${f.count}</td>
				<td>${f.info}</td>
				<td>${f.detail}</td>
				<td>${f.score}</td>
			</tr>
		</c:forEach>
	</table>
</body>
</html>